home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / lds / main.c < prev    next >
C/C++ Source or Header  |  1995-05-03  |  4KB  |  115 lines

  1. /*************************************************************************
  2.  *                                                                       *
  3.  *  Copyright (c) 1992, 1993 Ronald Joe Record                           *
  4.  *                                                                       *
  5.  *  All rights reserved. No part of this program or publication may be   *
  6.  *  reproduced, transmitted, transcribed, stored in a retrieval system,  *
  7.  *  or translated into any language or computer language, in any form or *
  8.  *  by any means, electronic, mechanical, magnetic, optical, chemical,   *
  9.  *  biological, or otherwise, without the prior written permission of:   *
  10.  *                                                                       *
  11.  *      Ronald Joe Record (408) 458-3718                                 *
  12.  *      212 Owen St., Santa Cruz, California 95062 USA                   *
  13.  *                                                                       *
  14.  *************************************************************************/
  15.  
  16. #include <stdio.h>
  17. #include "x.h"
  18. #include "defines.h"
  19. #include "externals.h"
  20. #include "xexterns.h"
  21.  
  22. /* external routines called in this file */
  23. extern void parseargs(), init_data(), init_mem(), init_gen(), init_canvas();
  24. extern void init_color(), Clear(), event_loop();
  25.  
  26. main(argc, argv)
  27. int argc;
  28. char **argv;
  29. {
  30.     XSizeHints hint;
  31.  
  32.     parseargs(argc, argv);
  33.     init_data();
  34.     init_mem();
  35.     /*
  36.      * Create the window to display the lattice dynamical system
  37.      */
  38.     hint.x = 0;
  39.     hint.y = 0;
  40.     hint.width = width;
  41.     hint.height = height;
  42.     hint.flags = PPosition | PSize;
  43.     canvas = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
  44.         hint.x, hint.y, hint.width, hint.height, 5, foreground, background);
  45.     XSetStandardProperties(dpy, canvas, "Lds by Ron Record", 
  46.         "Lds", None, argv, argc, &hint);
  47.     XChangeProperty(dpy, canvas, XA_WM_CLASS, XA_STRING, 8, PropModeReplace, 
  48.                     "lds", strlen("lds"));
  49.     XSelectInput(dpy,canvas,KeyPressMask|ExposureMask|StructureNotifyMask);
  50.     XMapRaised(dpy, canvas);
  51.     /*
  52.      * Create the window to display the spatial histogram
  53.      */
  54.     hint.x = (XDisplayWidth(dpy, screen) - width)/2;
  55.     hint.y = (XDisplayHeight(dpy, screen) - height)/2;
  56.     if (hint.x < 0) hint.x = 0;
  57.     if (hint.y < 0) hint.y = 0;
  58.     hint.width = width;
  59.     hint.height = height;
  60.     hint.flags = PPosition | PSize;
  61.     spahis = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
  62.         hint.x, hint.y, hint.width, hint.height, 5, foreground, background);
  63.     XSetStandardProperties(dpy, spahis, "Spatial Histogram", 
  64.         "Lds", None, argv, argc, &hint);
  65.     XSelectInput(dpy,spahis,KeyPressMask|ExposureMask|StructureNotifyMask);
  66.     if (sflag)
  67.         XMapRaised(dpy, spahis);
  68.     /*
  69.      * Create the window to display the site histogram curve
  70.      */
  71.     hint.x = XDisplayWidth(dpy, screen) - width - 50;
  72.     hint.y = XDisplayHeight(dpy, screen) - height - 50;
  73.     if (hint.x < 0) hint.x = 0;
  74.     if (hint.y < 0) hint.y = 0;
  75.     hint.width = width;
  76.     hint.height = height;
  77.     hint.flags = PPosition | PSize;
  78.     hiswin = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy),
  79.         hint.x, hint.y, hint.width, hint.height, 5, foreground, background);
  80.     XSetStandardProperties(dpy, hiswin, "Site Histogram", 
  81.         "Lds", None, argv, argc, &hint);
  82.     XSelectInput(dpy,hiswin,KeyPressMask|ExposureMask|StructureNotifyMask);
  83.     cmap = XCreateColormap(dpy, canvas, DefaultVisual(dpy, screen), AllocAll);
  84.     spcmap = XCreateColormap(dpy, spahis, DefaultVisual(dpy, screen), AllocAll);
  85.     hicmap = XCreateColormap(dpy, hiswin, DefaultVisual(dpy, screen), AllocAll);
  86.     if (hflag)
  87.         XMapRaised(dpy, hiswin);
  88.     if (displayplanes > 1) {
  89.         init_color(dpy,canvas,cmap,Colors,mincolor,mincolor,numcolors,
  90.                         numwheels, "lds", "Lds", 0);
  91.         if (hflag)
  92.             init_color(dpy,hiswin,cmap,Colors,mincolor,mincolor,numcolors,
  93.                         numwheels, "lds", "Lds", 0);
  94.         if (sflag)
  95.             init_color(dpy,spahis,cmap,Colors,mincolor,mincolor,numcolors,
  96.                         numwheels, "lds", "Lds", 0);
  97.     }
  98.     else
  99.         XQueryColors(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), 
  100.                 Colors, numcolors);
  101.     pixmap = XCreatePixmap(dpy, DefaultRootWindow(dpy), 
  102.             hint.width, hint.height, DefaultDepth(dpy, screen));
  103.     spamap = XCreatePixmap(dpy, DefaultRootWindow(dpy), 
  104.             hint.width, hint.height, DefaultDepth(dpy, screen));
  105.     init_canvas();
  106.     Clear(canvas);
  107.     if (hflag)
  108.         Clear(hiswin);
  109.     if (sflag)
  110.         Clear(spahis);
  111.     init_gen();
  112.     for(;;)
  113.         event_loop();
  114. }
  115.